package com.p2p.system.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.p2p.model.entity.Bidrequest;
import com.p2p.model.vo.SystemaccountVo;
import com.p2p.model.vo.SystemaccountflowVo;
import com.p2p.system.common.Result;
import com.p2p.system.entity.Iplog;
import com.p2p.system.entity.Systemaccount;
import com.p2p.system.entity.Systemaccountflow;
import com.p2p.system.service.SystemaccountService;
import com.p2p.system.service.SystemaccountflowService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 系统账户表 前端控制器
 * </p>
 *
 * @author 黄旭彬
 * @since 2023-12-18
 */
@RestController
@Api(tags = "系统账号管理")
@RequestMapping("/system/systemaccount")
public class SystemaccountController {

    @Autowired
    private SystemaccountflowService systemaccountflowService;

    @Autowired
    private SystemaccountService systemaccountService;

    @ApiOperation("系统账户流水查询")
    @GetMapping("/systemaccountflow/{page}/{limit}")
    public Result getaccountflowList(
            @PathVariable Long page,
            @PathVariable Long limit,
            SystemaccountflowVo systemaccountflowVo

    ){
        Page<Systemaccountflow> pageParam = new Page<>(page,limit);
        IPage<Systemaccountflow> pageModel1= systemaccountflowService.selectPage(pageParam,systemaccountflowVo);

        return Result.ok(pageModel1);
    }

    @ApiOperation("系统账户分页查询和条件查询")
    @GetMapping("/{page}/{limit}")
    public Result getsysaccountList(
            @PathVariable Long page,
            @PathVariable Long limit,
            SystemaccountVo systemaccountVo
    ){
        Page<Systemaccount> pageParm = new Page<>(page,limit);
        IPage<Systemaccount> page1 = systemaccountService.selectaccountPage(pageParm,systemaccountVo);
        return  Result.ok(page1);
    }

    @ApiOperation("查看账户流水")
    @PostMapping("/systemaccountflow/getsystemaccountflowById/{id}")
    public Result getsystemaccountflowById(@PathVariable Long id){
        Page<Systemaccountflow> pageParam = new Page<>(1,10);
        IPage<Systemaccountflow> page1 = systemaccountflowService.selectflowById(pageParam,id);
        return Result.ok(page1);
    }

}

